doctype html
html(lang="en")
    head
        include common_headers.pug
        - var tt = doc.title ? doc.title+' - '+doc.copyright+' | 必应每日高清壁纸 - 精彩,从这里开始' : doc.copyright+' | 必应每日高清壁纸 - 精彩,从这里开始';
        title #{tt}
        - var location = (doc.country && doc.city) ? doc.country + ', ' + doc.city : false;
        - location = doc.continent ? (location ? doc.continent + ', ' + location : doc.continent) : location;
        meta(name="keywords",content=`${doc.copyright}, ${doc.title}, ${location}, ${doc.dt}`)
        meta(name="description",content=`${doc.description}`)
        meta(name="author",content=`${doc.copyright}`)
        link(rel='stylesheet',href="/static/css/progressively.css")
        link(rel='stylesheet', href='/static/css/common.css')
        link(rel='stylesheet', href='/static/css/main.css')
        

    body.detail(oncontextmenu='self.event.returnValue=false')
        div.preview
            - var small = doc.photo;
            div.progressive
                - var cdn1 = `http://h1.ioliu.cn/bing/${doc.photo}_1366x768.jpg`;
                - var root =  'https://bing.ioliu.cn' ;
                - var attr = (!!doc['title'] && !!doc['description']) ? `#${doc['title']}# ${doc['description']}` : `${doc['copyright']}`;
                - var desc = `#必应壁纸# ${doc.dt} / ${attr}`;
                - var link = `http://service.weibo.com/share/share.php?url=${root}/photo/${doc.photo}&appkey=1833831541&ralateUid=5893653736&pic=${cdn1}&title=`+encodeURIComponent(desc.substring(0,126)+'...');
                img.target.progressive__img.progressive--not-loaded(src=doc.small,data-progressive=doc.large)
            div.mark
            div.options
                a.ctrl.left(href=`${doc.back_url}`)
                    i.icon.icon-left
                    em.t BACK
                a.ctrl.share(href=link,target="_blank",rel="nofollow",title="分享到微博")
                    i.icon.icon-share
                    em.t 分享
                span.ctrl.heart(photo=doc.id,likes=doc.likes)
                    i.icon.icon-heart
                    em.t #{doc.likes}
                a.ctrl.download(href=`/photo/${doc.photo}?force=download`,target="_blank")
                    i.icon.icon-download
                    em.t #{doc.downloads}
            div.description
                p.title #{doc.copyright}
                p.sub #{doc.description}
                p.calendari.icon.icon-calendar
                    em.t #{doc.dt}
                if location
                    p.location
                        i.icon.icon-location
                        em.t #{location}
                p.view
                    i.icon.icon-eye 
                    em.t #{doc.views}
        script(src='/static/js/jquery-1.12.4.min.js')
        script(src='/static/js/progressively.js')
        script(src='/static/js/baidu-analysis.js')
        script(src='/static/js/like.js')
        //- script(data-no-instant,src="/static/js/instantclick.min.js")
        //- script(data-no-instant,src="/static/js/mine-instantclick.js")
        script.
            $(function() {
                var i=0;
                var img = $('.target');
                var mini = img.attr('src');
                var mark = $('.mark');
                mark.css({
                    'background-image': 'url('+mini+')'
                });
                progressively.init({
                    delay: 20,
                    throttle: 300,
                    onLoad: function(elem) {
                    },
                    onLoadComplete: function() {
                        i++;
                        if(i>=2){
                            var big = img.attr('src');
                            mark.css({
                                backgroundImage: 'url('+big+')',
                                filter: 'blur(0)'
                            });
                            img.remove();
                        }
                    }
                });

                $(document).on('keydown',function(e){
                    e = e.event || window.event;
                    if(e.keyCode == 123 || (e.ctrlKey&&e.shiftKey&&e.keyCode==73) || (e.ctrlKey&&e.keyCode==85)) return false
                })
            });